package com.artron.mediaartron.ui.fragment.center;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.artron.baselib.base.BaseStaticFragment;
import com.artron.mediaartron.R;
import com.artron.mediaartron.data.net.NetConstant;
import com.artron.mediaartron.ui.activity.GeneralActivity;
import com.artron.mediaartron.ui.helper.ThrottleFirstClickHelper;

import butterknife.BindView;

/**
 * Class description here
 *
 * @author doing
 * @version 1.0.0
 * @since 2017-11-10.
 */

public class HelpListFragment extends BaseStaticFragment implements View.OnClickListener {

    @BindView(R.id.SettingFragment_tv_1)
    protected TextView mTv1;
    @BindView(R.id.SettingFragment_tv_2)
    protected TextView mTv2;
    @BindView(R.id.SettingFragment_tv_3)
    protected TextView mTv3;
    @BindView(R.id.SettingFragment_tv_4)
    protected TextView mTv4;
    @BindView(R.id.SettingFragment_tv_5)
    protected TextView mTv5;
    @BindView(R.id.SettingFragment_tv_6)
    protected TextView mTv6;
    @BindView(R.id.SettingFragment_tv_7)
    protected TextView mTv7;
    @BindView(R.id.SettingFragment_tv_8)
    protected TextView mTv8;

    public static HelpListFragment newInstance() {
        Bundle args = new Bundle();
        HelpListFragment fragment = new HelpListFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_help_list;
    }

    @Override
    protected void initView() {
        ThrottleFirstClickHelper.throttleFirst(mTv1, this);
        ThrottleFirstClickHelper.throttleFirst(mTv2, this);
        ThrottleFirstClickHelper.throttleFirst(mTv3, this);
        ThrottleFirstClickHelper.throttleFirst(mTv4, this);
        ThrottleFirstClickHelper.throttleFirst(mTv5, this);
        ThrottleFirstClickHelper.throttleFirst(mTv6, this);
        ThrottleFirstClickHelper.throttleFirst(mTv7, this);
        ThrottleFirstClickHelper.throttleFirst(mTv8, this);
    }

    @Override
    public void onClick(View v) {
        if (!(v instanceof TextView)) {
            return;
        }

        String text = ((TextView) v).getText().toString();
        String url = "";
        switch (v.getId()) {
            case R.id.SettingFragment_tv_1:
                url = NetConstant.HELP_1;
                break;
            case R.id.SettingFragment_tv_2:
                url = NetConstant.HELP_2;
                break;
            case R.id.SettingFragment_tv_3:
                url = NetConstant.HELP_3;
                break;
            case R.id.SettingFragment_tv_4:
                url = NetConstant.HELP_4;
                break;
            case R.id.SettingFragment_tv_5:
                url = NetConstant.HELP_5;
                break;
            case R.id.SettingFragment_tv_6:
                url = NetConstant.HELP_6;
                break;
            case R.id.SettingFragment_tv_7:
                url = NetConstant.HELP_7;
                break;
            case R.id.SettingFragment_tv_8:
                url = NetConstant.HELP_8;
                break;

        }
        GeneralActivity.start(mContext, GeneralActivity.HELP, text, url);
    }
}
